<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2>编辑商品</h2>
    </div>
    <form action="{:U('shopupdate')}" method="post" class="form-horizontal" enctype="multipart/form-data">
        <div class="form-item">
            <label class="item-label">标题<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="title" value="{$User.title}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">描述</label>
            <div class="controls">
                <input type="text" class="text input-large" name="des" value="{$User.des}">
            </div>
        </div>
         <div class="form-item">
            <label class="item-label">商品图片<span class="check-tips"></span></label>
            <div class="controls">
                <input type="file" class="text input-large" name="pic[]" value="" multiple>
            </div>
        </div>
        <div class="form-item">
           <select name="cate" id="cate" value="">
               <option value="">请选择</option>
               <volist name='cate' id='vv'>
                   <option value="{$vv['id']}">{$vv['title']}</option>
               </volist>
           </select>
        </div>
        <div class="form-item">
            <label class="item-label">是否推荐<span class="check-tips"></span></label>
            <div class="controls">
                <input type="radio" name="tuijian" value="1" {$User['tuijian']?'checked':''}>推荐
                <input type="radio" name="tuijian" value="0" {$User['tuijian']?'':'checked'}>不推荐
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">是否上架<span class="check-tips"></span></label>
            <div class="controls">
                <input type="radio" name="shangjia" value="1" 
                 {$User['shangjia']?'checked':''}
                >上架
                <input type="radio" name="shangjia" value="0"
                 {$User['shangjia']?'':'checked'}
                 >不上架
                <input type="hidden" name="id" value="{$User['id']}">
        </div>
        <div class="form-item">
            <button class="btn submit-btn" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
</block>

<block name="script">
    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U('Category/shop')}');
    </script>

<script type="text/javascript">
$(function(){
    $("body").on('change','select', function(){ 
            var id =$(this).val();
            var t = $(this);
            $.post("{:U('getchild')}",{id:id},
                function(res){
                    if (res.status==1){
                        t.nextAll().remove();
                        t.after(res.info);
                } 
            });
        });
  });
</script>
</block>